class Solution:
	# @param a list of integers
	# @return an integer
	def removeDuplicates(self, A):
		if len(A) <= 1:
			return len(A)
		i = j = 1
		for j in xrange(1, len(A)):
			if A[j] != A[j-1]:
				A[i] = A[j]
				i += 1
		return i
		

if __name__ == '__main__':
	so = Solution()
	a = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,]
	i = so.removeDuplicates(a)
	print(a[:i])